

<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/pageRc/common/common.jsp"%>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta name="format-detection" content="telephone=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="mobile-web-app-capable" content="yes">
	<meta name="msapplication-tap-highlight" content="no">
	<script type="text/javascript" src="<%=commonPath %>/pageRc/js/jquery-1.9.1.min.js"></script> 
 　	<link rel="stylesheet" href="<%=commonPath %>/pageRc/layui/css/layui.css" media="all">
 　　　<script type="text/javascript" src="<%=commonPath %>/pageRc/common/utils.js"></script>
	<script type="text/javascript" src="<%=commonPath %>/pageRc/common/msgTool.js"></script>
	<script type="text/javascript" src="<%=commonPath %>/pageRc/layui/layui.js"></script>　
	<title>修改需求信息</title> 
	<script type="text/javascript">
	var path = "<%=commonPath%>";
	var msg =new msgTool(); 
 
	</script>
</head>

 <body style="layui-main">
	 <div class="header">
	  <div class="main">
	  </div>
	</div>
             <form  id="createMsgForm" name="createMsgForm"  class="layui-form"  style="padding:1.5rem"  >
        <div class="layui-form-item">
    <div class="layui-inline">
     <label class="layui-form-label">所属项目组</label>
	              <div class="layui-input-block"> 
	                  <input id="rouid"  name = "rouid"  value="${needBean.rouid}"  type="hidden">
	                  <input id="proTeamNo"  name = "proTeamNo"  value="${needBean.proTeamNo}"  type="hidden">
	                  <input id="proTeamName"  name = "proTeamName"  value="${needBean.proTeamName}"  class="layui-input" disabled>
 	              </div>
    </div>
    <div class="layui-inline">
    <label class="layui-form-label">当前阶段 </label>
		       <div class="layui-input-inline">
					<select name="now_Stage" id="now_Stage" style="width: 210;">
					   <option value="${needBean.now_Stage}"></option>
					<option value="10">需求酝酿</option>
						<option value="01">需求分析</option>
						<option value="11">需求确认</option>
						<option value="02">需求评审</option>
						<option value="03">技术评审</option>
						<option value="04">开发联调</option>
						<option value="05">SIT测试</option>
						<option value="06">UAT测试</option>
						<option value="07">需求上线</option>
						<option value="08">回顾总结</option>
					</select>
				</div>
    </div>
  </div>
             
          <div class="layui-form-item">
          <div class="layui-inline">
    <label class="layui-form-label">需求编号</label>
	              <div class="layui-input-block"> 
	                  <input id="needNo"  name = "needNo"    class="layui-input"  placeholder="请输入需求编号" value="${needBean.needNo}"   required lay-verify="required" autocomplete="off" >
 	              </div>
    </div>
    <div class="layui-inline">
     <label  class="layui-form-label">需求名称</label>
                <div class="layui-input-block">
                    <input type="text" id="needName"  name="needName"  placeholder="请输入需求名称"  value="${needBean.needName}"  name="needName" required lay-verify="required" autocomplete="off" class="layui-input">
                </div>
    </div>
  </div>        
             
             
                 <div class="layui-form-item">
    <div class="layui-inline">
     <label  class="layui-form-label">人月 </label> 
                <div class="layui-input-block">
                  <input type="text" id="renyue" name="renyue" value="${needBean.renyue}"  placeholder="请输入人月"   required lay-verify="required" autocomplete="off" class="layui-input" onchange="getneedTime()">
                 </div>
    </div>
    <div class="layui-inline">
    <label  class="layui-form-label">评估工时  </label> 
                <div class="layui-input-block">
                  <input type="text" id="needTime" name="needTime"  value="${needBean.needTime}"   placeholder="按小时填写"   required lay-verify="required" autocomplete="off" class="layui-input" onchange="getrenyue()">
                 </div> 
    </div>
  </div>        
              
        
        <div class="layui-form-item">
    <div class="layui-inline">
    <label class="layui-form-label">行方经理</label>
			<div class="layui-input-block">
				<input type="text" id="hfjl" name="hfjl" placeholder="请输入行方经理"
					value="${needBean.hfjl}" name="hfjl" 
					autocomplete="off" class="layui-input">
			</div>
    </div>
    <div class="layui-inline">
    <label class="layui-form-label">行方业务人员 </label>
			<div class="layui-input-block">
				<input type="text" id="hfywry" name="hfywry"
					value="${needBean.hfywry}" placeholder="请输入行方业务人员" 
					 autocomplete="off" class="layui-input">
			</div>
    </div>
  </div>           
      <div class="layui-form-item">
	    <div class="layui-inline">
		    <label class="layui-form-label">规划状态 </label>
	       <div class="layui-input-block">
				<select name="planStatus" id="planStatus" style="width: 210;">
				    <option value="${needBean.planStatus}"></option>
					<option value="未立项">未立项</option>
					<option value="已立项">已立项</option>
					<option value="已过规划评审">已过规划评审</option>
					<option value="已下任务单">已下任务单</option>
					<option value="人力外包">人力外包</option>
				</select>
			</div>
	    </div>
	  </div>       
		
		<div class="layui-form-item">
    <div class="layui-inline">
    <label class="layui-form-label">合同号</label>
			<div class="layui-input-block">
				<input id="contractId" name="contractId" class="layui-input"
					placeholder="请输入合同号" value="${needBean.contractId}" 
					 autocomplete="off">
			</div>
    </div>
    <div class="layui-inline">
    <label class="layui-form-label">产品编号</label>
			<div class="layui-input-block">
				<input id="contractNo" name="contractNo" class="layui-input"
					placeholder="请输入产品编号" value="${needBean.contractNo}"
					 autocomplete="off">
			</div>
    </div>
  </div>           
		<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">合同批次</label>
			<div class="layui-input-block">
				<input id="contractApproval" name="contractApproval" class="layui-input"
					placeholder="请输入合同批次" value="${needBean.contractApproval}" 
					 autocomplete="off">
			</div>
			</div>
			<div class="layui-inline">
	    	<label class="layui-form-label">开始日期</label>
			 <div class="layui-input-block">
				<input class="layui-input" style="width: 210" id="createDate" name="createDate"
					value="${needBean.createDate}"
					onclick="layui.laydate({elem: this, istime: true, format: 'YYYYMMDD'})">
			</div> 
	    </div>
		</div>
               
              <div class="layui-form-item"> 
              	<div class="layui-input-block">
	              	  <c:choose>
	              	 	 <c:when test="${needBean.state=='02'}">
	              	 	 	<button class="layui-btn" lay-filter="submitData" lay-submit>修改提交</button>
	              			<button class="layui-btn" type="button" style="background-color: red;" onclick="custom_close()">需求已关闭</button>	 	 	
	              		 </c:when>
	              		 <c:otherwise>
	              		 	  <button class="layui-btn" lay-filter="submitData" lay-submit>修改提交</button>
	              		 	  <button class="layui-btn" type="button" onclick="closeTask('${needBean.rouid}')" style="background-color: red;">关闭任务</button> 	 	
	              		 </c:otherwise>
	              	 </c:choose> 
    	          </div>
              </div>  
          </form> 
<script> 
  layui.use(
		[ 'form', 'layer', 'laytpl', 'laypage','laydate' ],
		 function(){
			var form = layui.form(),
			layer = layui.layer;
			 var index = parent.layer.getFrameIndex(window.name); //获取当前窗体索引
			form.on('submit(submitData)',function(data){
				var field = data.field;
				if(field.needTime<=80){
					   layer.confirm("你确定你的评估工时的单位是小时吗？如果不是请点击取消。",{icon:3,title:"提示"},function(index){
 						   msg.sendMsg("/page/need/updateNeedInfor.do",field,function(data){ //新加的微信登录入口
								/* layer.alert("修改成功！"); */
								index = parent.layer.getFrameIndex(window.name);
								if(index>=1)
				                    parent.layer.close(index); //执行关闭
				                else
									location.href ="<%=commonPath %>/page/need/doShowNeedInfor.do";
							}); 
					   }); 
				}else{
					 msg.sendMsg("/page/need/updateNeedInfor.do",field,function(data){ //新加的微信登录入口
							/* layer.alert("修改成功！"); */
							if(index>=1)
			                    parent.layer.close(index); //执行关闭
			                else
								location.href ="<%=commonPath %>/page/need/doShowNeedInfor.do";
						}); 
				}
				return false;
			});
});

  function closeTask(rouid) {
      var jsonDate = {};
      jsonDate.rouid = rouid;
      var index = parent.layer.getFrameIndex(window.name); //获取当前窗体索引
      layer.confirm("关闭后将不能打开,你确定要关闭这个任务吗?",{icon:3,title:"提示"},function(index){
				msg.sendMsg("/page/base/closeNeedInfor.do",jsonDate,function(data){ //新加的微信登录入口
					index = parent.layer.getFrameIndex(window.name);
					if(index>=1)
	                    parent.layer.close(index); //执行关闭
	                else
				  		location.href ="<%=commonPath %>/page/base/dologin.do";
				});
		   }); 
  }
  function custom_close(){
	  window.opener=null;
	  window.open('','_self');
	  window.close();
  }
  
  function getneedTime(){
      var num1 = document.getElementById('renyue').value; //获取第一个输入框的值
      if (isNaN(num1)) {  //如果为非数字，结果为空
          document.getElementById('needTime').value = "";
      } else {  //将第二个输入框设置为工时的结果
    	  var num  = num1*22*8;
    	  document.getElementById('needTime').value = num.toFixed(2);
          
      }
  } 
  
  
  function getrenyue(){
      var num1 = document.getElementById('needTime').value; //获取第一个输入框的值
      if (isNaN(num1)) {  //如果为非数字，结果为空
          document.getElementById('renyue').value = "";
      } else {  //将第二个输入框设置为人月的结果
          document.getElementById('renyue').value = num1/22/8;
      }
  } 
  
  function getContractId(){
      var contractNo = document.getElementById('contractNo').value; //获取第一个输入框的值
      if(contractNo == '' || contractNo == null){
    	  layer.alert("请填写产品编号！");
      }else{
    	  $.ajax({
    	  		type:'POST',
    	  		url:'<%=commonPath %>/page/contract/selectContractIdByContractNo.do?contractNo='+contractNo,
    	  		dataType:'JSON',
    	  		success:function(data){
    	  			var contractId = data.body.contractId;
   	  				if(contractId == '' || contractId == null){
   	  					layer.alert("没有匹配的合同号！");
   	  				}else{
   	  					document.getElementById('contractId').value = contractId;
   	  				}
    	  		}
    	  	})
      }
  } 
</script>
</body>
</html>
 
 